<!DOCTYPE html>
<html lang="en">
  <head>
      <meta charset="UTF-8">
      <title>逻辑运算符</title>
    <script type="text/javascript">
      var name = "lmy";
      var age = 8;
      n = null;
      //0 null undefined "" NaN 都认为是false
      if (!n) {
        alert("hi");
      }

      var address;//undefined
      if (!address) {
        alert("ok");
      }

      var res1 = null && 800;
      alert("res1=" + res1);//null
      var res2 = "lmy" || 800;
      alert("res2=" + res2);//lmy

      var res3 = (10 > 1) && (6 < 0);
      alert("res3=" + res3);//false

      var n1 = 1;
      var n2 = 3;
      var res4 = n1++ || n2++;// n1++执行完后就不执行n2++(短路或)
      alert("n1=" + n1 + " n2=" + n2);  //2 3
    </script>
  </head>

  <body>

  </body>
</html>